package com.usian.feign;

import com.usian.pojo.*;
import com.usian.utils.AdNode;
import com.usian.utils.ItemCatResult;
import com.usian.utils.PageResult;
import com.usian.utils.PreUpdate;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "usian-item-service")
public interface ItemFeign {

    @RequestMapping("/findItemById")
    @ResponseBody
    public TbItem findItemById(@RequestParam Long id);

    @RequestMapping("/selectTbItemAllByPage")
    public PageResult selectTbItemAllByPage(@RequestParam Integer page, @RequestParam Integer rows);

    @RequestMapping("selectItemCategoryByParentId")
    List<TbItemCat> selectItemCategoryByParentId(@RequestParam Integer id);

    @RequestMapping("selectItemParamByItemCatId/{itemCatId}")
    TbItemParam selectItemParamByItemCatId(@PathVariable(value = "itemCatId") Integer itemCatId);

    @RequestMapping("/insertTbItem")
    Boolean insertTbItem(@RequestBody TbItem tbItem, @RequestParam String desc, @RequestParam String itemParams);

    @RequestMapping("deleteItemById")
    Boolean deleteItemById(@RequestParam String itemId);

    @RequestMapping("preUpdateItem")
    PreUpdate preUpdateItem(@RequestParam Long itemId);

    @RequestMapping("updateTbItem")
    Boolean updateTbItem(@RequestBody TbItem tbItem, @RequestParam String desc, @RequestParam String itemParams);

    @RequestMapping("selectItemParamAll")
    PageResult selectItemParamAll();

    @RequestMapping("insertItemParam")
    Boolean insertItemParam(@RequestParam Long itemCatId, @RequestParam String[] paramData);

    @RequestMapping("deleteItemParamById")
    Boolean deleteItemParamById(@RequestParam Long id);

    @RequestMapping("/selectItemCategoryAll")
    ItemCatResult selectItemCategoryAll();


    @RequestMapping("selectItemDescByItemId")
    TbItemDesc selectItemDescByItemId(@RequestParam Long itemId);

    @RequestMapping("selectTbItemParamItemByItemId")
    TbItemParamItem selectTbItemParamItemByItemId(@RequestParam Long itemId);
}
